import binascii
import math
import os
import sys
import threading
import time
from ctypes import WinDLL, windll

from pynput.mouse import Listener
from pytesseract import pytesseract
from PIL import Image
import pyautogui
import win32com
from win32api import GetCursorPos
from win32com import client
from win32com.client import Dispatch

# 加载大漠
from util.GameUtil import readMemory, writeData

lock = windll.LoadLibrary('user32.dll');
dm = win32com.client.Dispatch('dm.dmsoft')


# 读并且写测试函数1
def m1():
    hwnd = dm.FindWindow("MainWindow", "植物大战僵尸中文版")
    adr = "[[006a9ec0]+768]+5560";
    val = readMemory(dm, hwnd, adr, 0);
    writeData(dm, hwnd, adr, 0, val * 2);


if __name__ == '__main__':
    m1();
